package com.briup.ch11;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/16
 * @Description:
 */
public class Test11 {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("test.txt");
        FileWriter fw = new FileWriter("test2.txt",true);
        char[] buffer = new char[1024];
        int c=0;
        while ((c = fr.read(buffer))!= -1) {
            //打印
            System.out.println(new String(buffer,0,c));
            fw.write(buffer,0,c);
        }
        fr.close();
        fw.close();
    }
}
